<?php

/*
 * This class is used for as Model for Metadata table 
 */

class Model_Discount extends Model_Base {

    protected $_name = 'tbl_discount';
    protected $_primaryKey = 'dis_id';
		
		
	public function fetchnextNum($number) {
	
		$select = $this->select()
                ->from(array('discount' => 'tbl_discount'));
		$select->where("dis_nextnum LIKE '$number%'");
		$select->order("dis_createdate DESC"); 
		$select->limit(1);		
		$couponData = $this->fetchRow($select);
		
		//echo $select; exit;
		
		if ($couponData) {
			return $couponData->dis_nextnum;
		} else {
			return false;
		}
	}	
}
